// Include guards
#ifndef CVISUBSYSTEM_H
#define CVISUBSYSTEM_H

#include "Logger/ILogger.h"

class ISubSystem
{

public:
	virtual ~ISubSystem() {}

	/**
	 * Initializes the subsystem. If either an exception is thrown or the method returns false,
	 * the SubSystemManager will stop further initialization of subsystems, shutdown the
	 * already initialized subsystems and then the whole execution environment with error message.
	 * @throws Exception, possibly
	 * @return true, if the subsystem was successfully initialized, otherwise false
	 */
	virtual bool initialize() = 0;

	/**
	 * Releases subsystem-specific resources and shuts down the subsystem.
	 * Called by SubSystemManager when the execution environment is being shut down.
	 */
	virtual void shutdown() = 0;

	/**
	 * Returns is the subsystem initialized or not
	 * @return true, if the subsystem is initialized, otherwise false
	 */
	virtual bool isInitialized() = 0;

	/**
	 * Changes the subsystem configuration to match given configuration.
	 * @throws InvalidConfigurationException, if the configuration isn't valid for this subsystem.
	 */
	//virtual void configure(IConfiguration& config) = 0;

	/**
	 * Returns the name of this subsystem as c-string (null-terminated char-array)
	 * @return Name of the subsystem
	 */
	virtual const char* getName() = 0;

	/**
	 * Sets the logger this subsystem should use
	 * @param logger	Logger to use
	 */
	virtual void setLogger(ILogger* logger) { m_logger = logger; }

	/**
	 * Returns the logger used by this subsystem
	 */
	virtual ILogger* getLogger() { return m_logger; }

protected:

	ILogger* m_logger;
};

#endif // #ifndef CVISUBSYSTEM_H
